<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<head lang="en">
    <th:block th:include="include :: header('上传文件')"/>
</head>
<body>

<button type="button" class="layui-btn" id="test1">
    <i class="layui-icon">&#xe67c;</i>上传图片文件
</button>
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="demo" style="margin-top: 18px">
    <div class="layui-progress-bar layui-bg-red" lay-percent="0%"></div>
</div>

<th:block th:include="include :: footer"/>
<script type="text/javascript" src="/js/upload.js"></script>
<script type="text/javascript">
    layui.use(['upload', 'element'], function () {
        var upload = layui.upload;
        var element = layui.element;
        //执行实例
        var uploadInst = upload.render({
            elem: '#test111' //绑定元素
            , url: '/sysUser/upimgs.json' //上传接口
            , exts: 'zip|rar|7z'
            , choose: function (obj) {
                element.progress('demo', "0%");
            }
            , done: function (res) {

                //上传完毕回调
            }
            , error: function () {
                //请求异常回调
            }
            , progress: function (n) {
                var percent = n + '%' //获取进度百分比
                element.progress('demo', percent); //可配合 layui 进度条元素使用
            }
        });

        uploadImages(upload,"test1",'/sysUser/upimgs.json',"image",function (data) {
            console.log(data);
        })
    })
</script>
<script type="text/javascript">
    function ApplicationSave() {
        document.getElementById("submit").click();
    }
</script>
</body>
</html>
